
		<div id="main-content"> <!-- Main Content Section with everything -->			
			<!-- Page Head -->			
			<form id="search" name='search' method='get' action=''>
				<label>关键词：</label>
				<input class="text-input" id='key' type='text' name='key' value='<?php echo $search['key']?$search['key']:'';?>' />
				<select name="options" id="op">
					<option value="0" <?php echo $options=='0'?'selected':'';?>>库存</option>
					<option value="1" <?php echo $options=='1'?'selected':'';?>>已分配</option>
					<option value="2" <?php echo $options=='2'?'selected':'';?>>报废</option>
				</select> 
				修改时间
				<input class="text-input time" type="text" id="from" name="from" value='<?php echo $search['from']?$search['from']:'';?>' />
				~
				<input class="text-input time" type="text" id="to" name="to" value='<?php echo $search['to']?$search['to']:'';?>' />
				<input class="button" type='submit' value='搜索' />
				<input class='reset button' type='button' value='重置'/>
			</form>
			<div class="clear"></div> <!-- End .clear -->
			
			<div class="content-box"><!-- Start Content Box -->
				
				<div class="content-box-header">
					<h3>查询</h3>
					<div class="clear"></div>
					
				</div> <!-- End .content-box-header -->
				
				<div class="content-box-content">
					
					<div class="tab-content default-tab" id="tab1"> <!-- This is the target div. id must match the href of this div's tab -->						
						<table>
							
							<thead>
								<tr>
								   
								   <th>No.</th>
								   <th>名称</th>
								   <th>购入时间</th>
								   <th>使用状况</th>
								   <th>报废状况</th>
								</tr>
								
							</thead>
						 
							<tfoot>
								<tr>
									<td colspan="6">										
										<div class="pagination">
											<?php echo $page;?><!-- 分页 -->										
										</div> <!-- End .pagination -->
										<div class="clear"></div>
									</td>
								</tr>
							</tfoot>
						 
							<tbody>
							<?php $i=0; foreach($query as $row):?>
								<tr>									
									<td><?php $i++;echo $i;?></td>
									<td>
									<?php
										if($row['categoryid'] != '3'){
											echo $row['brand'].$row['condition'].$row['name'];
										}else{
											echo $row['brand'].'《'.$row['name'].'》';
										}
									?>
									</td>
									<td><?php echo date('Y-m-d',$row['bought']);?></td>
									<td>
									<?php 
										foreach($row['use_status'] as $r){
											echo $r['content'].'；';
										}
									?>
									</td>
									<td>
									<?php
										switch($row['status']){
											case '0':
												echo '未分配';
												break;
											case '1':
												echo '已分配';
												break;
											case '2':
												echo '已报废';
												break;
										}
									?>
									</td>
								</tr>
							<?php endforeach;?>	
							</tbody>
							
						</table>
						
					</div> <!-- End #tab1 -->
					
	
					
				</div> <!-- End .content-box-content -->
				
			</div> <!-- End .content-box -->
			<div class="clear"></div>			
		</div> <!-- End #main-content -->	

<script>
$(function(){
	$('.info').click(function(){
		str = $(this).parent().find("input").val();
		$.post("<?php echo base_url()?>office_consumable/host_detail/"+str,function(data){
			//将json转成js对象
			var obj = new Function("return" + data)();
			var detail = "<h3>主机名：</h3><p>"+obj.name+"</p><h3>主机配件：</h3>";
			var parts = obj.host_parts;
			var j=0;
			for(i=0;i<parts.length;i++){
				j++;
				detail += "<p>"+j+".&nbsp;名称："+parts[i].name+"&nbsp;&nbsp;&nbsp;&nbsp;品牌："+
								parts[i].brand+"&nbsp;&nbsp;&nbsp;&nbsp;规格："+
								parts[i].condition+
							"</p>";
			}
			$('#message').html(detail);
		});
		//jquery ui
		$( "#message" ).dialog( "open" );
	});
	//jquery ui
	$( "#message" ).dialog({
		autoOpen: false,
		show: "drop",
		hide: "explode",
		height: 400,
		width: 500,
		modal: true,
	});
	
	$( "#dialog-form" ).dialog({
		autoOpen: false,
		//show: "slide",
		//hide: "explode",
		height: 200,
		width: 350,
		modal: true,
		buttons: {
			Submit: function() {
				$('#log').submit();
			},
			Cancel: function() {
				$( this ).dialog( "close" );
			}
		},
		close: function() {
			allFields.val( "" ).removeClass( "ui-state-error" );
		}
	});

	$( ".create-user" ).dblclick(function() {
		str =$(this).text();
		id = $(this).find('input').val();
		$("#rid").val(id);
		$("#remark").val(str);
		$( "#dialog-form" ).dialog( "open" );
	});
	//time
	var dates = $( "#from, #to" ).datepicker({
		defaultDate: "+1w",
		changeMonth: true,
		numberOfMonths: 3,
		dateFormat: 'yy-mm-dd',
		onSelect: function( selectedDate ) {
			var option = this.id == "from" ? "minDate" : "maxDate",
				instance = $( this ).data( "datepicker" ),
				date = $.datepicker.parseDate(
					instance.settings.dateFormat ||
					$.datepicker._defaults.dateFormat,
					selectedDate, instance.settings );
			dates.not( this ).datepicker( "option", option, date );
		}
	});
	
	$("#op").change(function(){
		$("#search").submit();
	});
})
</script>